home *** CD-ROM | disk | FTP | other *** search
/ ftp.whtech.com / ftp.whtech.com.tar / ftp.whtech.com / datasheets and manuals / Hardware / WHT / scsi / dsr_sources_2_2001 / bankit < prev    next >
Text File  |  2006-10-19  |  4KB  |  120 lines

  1. *BANKIT
  2.  
  3. * This is the part of the BANKIT code that should be assembled into every
  4. * used Eprom bank. The main part of BANKIT is placed into the RAM bank 0
  5. * during the powerup routine. For safety, maybe we should think about placing
  6. * it there during every DSR call?
  7. *
  8. * This routine will bank in the requested eprom bank and branch to the routine
  9. * specified. For convenience, all routines will have the bank and offset
  10. * equated to a label.
  11. *
  12. * calling format 1:
  13. *
  14. * BLWP @BANKIT
  15. * DATA <bank# & offset>       as equated
  16. *
  17. * control will be returned to the bank that called the routine, directly
  18. * following the DATA statement.
  19. *
  20. * for the sub to return control to the caller, all it has to do is to B or BL
  21. * to address BNKRT. The sub must make sure that RAM 0 is mapped in.
  22. *
  23. * calling format 2:
  24. *
  25. * BL   @BLNKIT
  26. * DATA <bank# & offset>
  27. *
  28. * Functions the same as bankit, but will map in ram bank 0 for you.
  29. * There is also a return that will bank in ram 0 for you: BLRET. All bankit
  30. * routines may be used interchangably. You may call your return with the
  31. * BLWP @BANKIT and use the B (or BL) @BLRET to return to the calling
  32. * routine. Or whatever. The only difference is if you want the bankit routines
  33. * to map in ram bank 0 or not. There is less overhead (read: it's faster) if
  34. * you don't use the BL calls to bankit.
  35. *
  36. *
  37. * By Brad Snyder for the WHT SCSI Adaptor. 12-23-94.
  38. * Updated 12-28-94 bls
  39. * debug 1/3/94 bls - had blwp vectors reversed.
  40. * updated 01-06-95 - addresses changed
  41. * updated 01-17-95 - moved stack handler to rom
  42. * updated 02-05-95 - added BL call to bankit
  43. * updated 02-16-95 - added equates for dsrrt routine
  44. * updated 03-29-95 - added direct access to bank routine called XFER
  45.  
  46. * Addresses used in bank 0 of SCSI ram
  47.  
  48. AINIT  EQU  >5C58             init string
  49. ALWS   EQU  >5C5C             WS for allocate and de-allocate
  50. *PATH  EQU  >5C7C             path buffer (Now in bank 2)
  51. DSRRT  EQU  >5CA4             routine in ram to return from dsr
  52. PABADR EQU  >5CC0             2 byte pab pointer
  53. PABBUF EQU  >5CC2             10 byte pab buffer
  54. TMPWS  EQU  >5CCC             32 bytes for saving WS registers
  55. SAVR1  EQU  TMPWS+2
  56. SAVR11 EQU  TMPWS+22
  57. FNCB   EQU  >5CEC
  58. STACK  EQU  >5CF6             pointer to bankit stack
  59. BANKWS EQU  >5DB6
  60. SAVDEV EQU  >5DFB             last device # (scsi id) accessed
  61. SAVSEC EQU  >5DFC             sector number last accessed (2 words)
  62. SECBUF EQU  >5E00             512 byte last sector read
  63. STINIT EQU  >5CF8             stack init value
  64. STK    EQU  >5CF6             stack pointer
  65.  
  66. * Bankit routines for ROM
  67.  
  68. BANKIT DATA BANKWS,BNKIT1     Using WS in RAM bank 0. RAM bank 0 must be
  69. *                             mapped in before calling this routine!
  70.  
  71. ZERO   DATA 0                 general purpose zero
  72.  
  73. * BL call to bankit. R12 must hold the CRU base of the SCSI card in the
  74. * MSbyte. Bank 0 of the ram will be mapped in and left mapped in, even on
  75. * return to the caller.
  76.  
  77. * Registers dest.: R12
  78.  
  79. BLNKIT ANDI R12,>FF00
  80.        AI   R12,12*2          point to ram mapper
  81.        LDCR @ZERO,4           map in bank zero
  82.        MOV  R11,@BANKWS+28    save return address for rtwp return
  83.        STWP R11
  84.        MOV  R11,@BANKWS+26    store current WP
  85.        STST R11
  86.        MOV  R11,@BANKWS+30    store status
  87.        LWPI BANKWS            use bankws
  88.  
  89. * This code used by both versions of bankit
  90.  
  91. BNKIT1 MOV  @STACK,R9         get stack pointer
  92.        MOV  @BANKN,*R9+       save calling eprom bank on stack
  93.        MOV  *R14+,R1          move called routine bank and offset to RO
  94.        MOV  R13,*R9+          save return WS
  95.        MOV  R14,*R9+          save return address
  96.        MOV  R15,*R9+          save status
  97.        MOV  R9,@STACK         save stack pointer
  98.        B    @>5DD6            branch to banking code already in RAM
  99.  
  100. * BL return to caller routine
  101.  
  102. * R12 must contain the CRU base of the SCSI card
  103.  
  104. BLRET  ANDI R12,>FF00
  105.        AI   R12,12*2
  106.        LDCR @ZERO,4           map bank 0 ram back in
  107.  
  108. * Code used by both versions of the return to caller routine
  109.  
  110. BNKRT  LWPI BANKWS            be sure!
  111.        MOV  @STACK,R9         get stack pointer
  112.        AI   R9,-8             point back to old stuph
  113.        MOV  R9,@STACK         save pointer
  114.        MOV  *R9+,R10          get bank to return to
  115.        MOV  *R9+,R13          get WS
  116.        MOV  *R9+,R14          get ret. addr.
  117.        MOV  *R9+,R15          get status
  118.        B    @>5DEC            branch to code in ram
  119.  
  120.